package cn.com.wdjedu.androidapp.wjeduandroid.support.lib.imagesave;

import android.graphics.Bitmap;

import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.imagesave.support.ImageSaverBase;
import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.imagesave.support.ImageSaverBaseImpl;

/**
 * 图片保存类 2017/1/14.
 */

public class ImageSaver implements ImageSaverBase {

    private ImageSaverBase mImageSaver; /*图片保存*/
    private static ImageSaver imageSaver;

    private ImageSaver() {
        mImageSaver = new ImageSaverBaseImpl();
    }

    public static ImageSaver getInstance() {
        if (imageSaver == null) {
            synchronized (ImageSaver.class) {
                if (imageSaver == null) {
                    imageSaver = new ImageSaver();
                }
            }
        }
        return imageSaver;
    }

    @Override
    public String saveImage(Bitmap bitmap, String path) {
        return mImageSaver.saveImage(bitmap, path);
    }

    @Override
    public String saveImage(Bitmap bitmap, String directory, String fileName) {
        return mImageSaver.saveImage(bitmap, directory, fileName);
    }

    @Override
    public String saveImage(byte[] bytes, String path) {
        return mImageSaver.saveImage(bytes, path);
    }

    @Override
    public String saveImage(byte[] bytes, String directory, String fileName) {
        return mImageSaver.saveImage(bytes, directory, fileName);
    }
}
